package com.ldb.Controller.service;

import java.util.List;

import com.ldb.Controller.dao.AdminDao;
import com.ldb.Controller.entity.Admin;

public class AdminManager {

	private AdminDao admindao;

	public AdminDao getAdminDao() {
		return admindao;
	}

	public void setAdminDao(AdminDao admindao) {
		this.admindao = admindao;
	}
	
	public Admin getAdminByName(String name) {
		this.admindao.setClazz(Admin.class);
		List<Admin> list = this.admindao.getEntityList("adminName", name);
		if(list.size() <= 0) {
			return null;
		}else {
			return list.get(0);
		}
	}
	
	public void addAdmin() {
		Admin admin = new Admin();
		admin.setAdminName("admin");
		admin.setPassword("admin");
		this.admindao.addEntity(admin);
	}
	
}
